﻿import Store from '../../vuex/store';

//变量
var _cache;

export default {
    init({ store }) {

    },
    l(k, arr) {
        if (!_cache) {
            _cache = {};
            var _config = Store.getters.getConfiguration;
            var _values = _config.localization.values;
            for (var k1 in _values) {
                var group = _values[k1];
                for (var k2 in group) {
                    var item = group[k2];
                    _cache[k1 + '.' + k2] = item;
                }
            }
            var BangleAbpGroup = _values["BangleAbp"];
            for (var k2 in BangleAbpGroup) {
                var item = BangleAbpGroup[k2];
                _cache[k2] = item;
            }
        }
        if (_cache[k]) {
            var _r = _cache[k];
            if (arr && arr.length > 0) {
                for (var i = 0; i < arr.length; i++) {
                    _r = _r.replace('{' + i + '}', arr[i]);
                    console.log(_r);
                }
            }
            return _r;
        }
        return '#' + k + '#';
    }
}